michael@325: Index: agent/auto_nlist.c michael@353: diff -Nau agent/auto_nlist.c.orig agent/auto_nlist.c michael@353: --- agent/auto_nlist.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/auto_nlist.c 2011-09-15 09:22:50.256627584 +0200 michael@325: @@ -53,6 +53,7 @@ michael@325: } michael@325: if (*ptr == 0) { michael@325: *ptr = (struct autonlist *) malloc(sizeof(struct autonlist)); michael@325: + memset(*ptr, 0, sizeof(struct autonlist)); michael@325: it = *ptr; michael@325: it->left = 0; michael@325: it->right = 0; michael@325: Index: agent/mibgroup/mibII/tcp.c michael@353: diff -Nau agent/mibgroup/mibII/tcp.c.orig agent/mibgroup/mibII/tcp.c michael@353: --- agent/mibgroup/mibII/tcp.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/mibII/tcp.c 2011-09-15 09:22:50.258135285 +0200 michael@353: @@ -88,7 +88,7 @@ michael@325: * But only define it under FreeBSD, since it michael@325: * breaks other systems (notable AIX) michael@325: */ michael@325: -#ifdef freebsd4 michael@325: +#if defined (freebsd4) || defined (__NetBSD__) michael@325: int hz = 1000; michael@325: #endif michael@325: michael@325: Index: agent/mibgroup/mibII/tcpTable.c michael@353: diff -Nau agent/mibgroup/mibII/tcpTable.c.orig agent/mibgroup/mibII/tcpTable.c michael@353: --- agent/mibgroup/mibII/tcpTable.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/mibII/tcpTable.c 2011-09-15 09:22:50.260414149 +0200 michael@353: @@ -110,6 +110,11 @@ michael@325: #define TCPTABLE_REMOTEPORT pcb.inp_fport michael@325: #define TCPTABLE_IS_LINKED_LIST michael@325: michael@325: +#if defined(__FreeBSD__) michael@325: +#undef INP_NEXT_SYMBOL michael@325: +#define INP_NEXT_SYMBOL inp_next michael@325: +#endif michael@325: + michael@325: #endif /* linux */ michael@325: #endif /* WIN32 cygwin */ michael@325: #endif /* solaris2 */ michael@353: @@ -892,12 +897,17 @@ michael@325: nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb); michael@325: if (!nnew) michael@325: break; michael@325: +#if defined(__FreeBSD__) michael@325: + memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp), michael@325: + sizeof(struct inpcb)); michael@325: +#else michael@325: nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state]; michael@325: if (nnew->state == 5 /* established */ || michael@325: nnew->state == 8 /* closeWait */ ) michael@325: tcp_estab++; michael@325: memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp), michael@325: sizeof(struct inpcb)); michael@325: +#endif michael@325: michael@353: if (nnew->pcb.inp_vflag & INP_IPV6) michael@353: free(nnew); michael@325: Index: agent/mibgroup/ucd-snmp/diskio.c michael@353: diff -Nau agent/mibgroup/ucd-snmp/diskio.c.orig agent/mibgroup/ucd-snmp/diskio.c michael@353: --- agent/mibgroup/ucd-snmp/diskio.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/ucd-snmp/diskio.c 2011-09-15 09:22:50.263188251 +0200 michael@353: @@ -800,6 +800,20 @@ michael@325: case DISKIO_DEVICE: michael@325: *var_len = strlen(stat->dinfo->devices[indx].device_name); michael@325: return (u_char *) stat->dinfo->devices[indx].device_name; michael@325: +#if defined(freebsd5) && (__FreeBSD_version >= 500107) michael@325: + case DISKIO_NREAD: michael@325: + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ]; michael@325: + return (u_char *) & long_ret; michael@325: + case DISKIO_NWRITTEN: michael@325: + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE]; michael@325: + return (u_char *) & long_ret; michael@325: + case DISKIO_READS: michael@325: + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ]; michael@325: + return (u_char *) & long_ret; michael@325: + case DISKIO_WRITES: michael@325: + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE]; michael@325: + return (u_char *) & long_ret; michael@325: +#else michael@325: case DISKIO_NREAD: michael@325: #if defined(freebsd5) && __FreeBSD_version >= 500107 michael@325: long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ]; michael@353: @@ -857,6 +871,7 @@ michael@325: case DISKIO_LA15: michael@325: long_ret = devloads[indx].la15; michael@325: return (u_char *) & long_ret; michael@325: +#endif michael@325: michael@325: default: michael@325: ERROR_MSG("diskio.c: don't know how to handle this request."); michael@325: Index: agent/mibgroup/ucd-snmp/memory_solaris2.c michael@353: diff -Nau agent/mibgroup/ucd-snmp/memory_solaris2.c.orig agent/mibgroup/ucd-snmp/memory_solaris2.c michael@353: --- agent/mibgroup/ucd-snmp/memory_solaris2.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/ucd-snmp/memory_solaris2.c 2011-09-15 09:22:50.264370106 +0200 michael@325: @@ -1,3 +1,4 @@ michael@325: +#undef _FILE_OFFSET_BITS /* swapctl doesn't support 64bit off_t */ michael@325: #include /* local SNMP configuration details */ michael@325: #if HAVE_STRING_H michael@325: #include michael@325: Index: agent/mibgroup/ucd-snmp/proc.c michael@353: diff -Nau agent/mibgroup/ucd-snmp/proc.c.orig agent/mibgroup/ucd-snmp/proc.c michael@353: --- agent/mibgroup/ucd-snmp/proc.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/ucd-snmp/proc.c 2011-09-15 09:22:50.265801863 +0200 michael@325: @@ -1,3 +1,6 @@ michael@325: +#ifdef solaris2 michael@325: +#undef _FILE_OFFSET_BITS /* solaris procfs doesn't support 64bit off_t */ michael@325: +#endif michael@325: #include michael@353: #include michael@325: michael@325: Index: agent/mibgroup/util_funcs.c michael@353: diff -Nau agent/mibgroup/util_funcs.c.orig agent/mibgroup/util_funcs.c michael@353: --- agent/mibgroup/util_funcs.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/mibgroup/util_funcs.c 2011-09-15 09:22:50.267863457 +0200 michael@353: @@ -477,6 +477,9 @@ michael@325: int fd[2][2], i, cnt; michael@325: char ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv, michael@325: **aptr; michael@325: + michael@325: + *pid = -1; /* open_persist_pipe ignores return code but checks *pid */ michael@325: + michael@325: /* michael@325: * Setup our pipes michael@325: */ michael@713: Index: agent/mibgroup/host/hrh_filesys.c michael@713: diff -Nau agent/mibgroup/host/hrh_filesys.c.orig agent/mibgroup/host/hrh_filesys.c michael@713: --- agent/mibgroup/host/hrh_filesys.c.orig 2011-09-28 06:53:47.000000000 +0200 michael@713: +++ agent/mibgroup/host/hrh_filesys.c 2012-10-04 14:04:40.672808452 +0200 michael@713: @@ -298,9 +298,9 @@ michael@713: } else { michael@713: HRFS_entry = netsnmp_fsys_get_first(); michael@713: } michael@713: - /* Skip "inactive" entries */ michael@713: - while ( HRFS_entry && !(HRFS_entry->flags & NETSNMP_FS_FLAG_ACTIVE)) michael@713: - HRFS_entry = netsnmp_fsys_get_next( HRFS_entry ); michael@713: + /* Skip "inactive" entries - Edit: Avoid ignoring ZFS! */ michael@713: + /*while ( HRFS_entry && !(HRFS_entry->flags & NETSNMP_FS_FLAG_ACTIVE)) michael@713: + HRFS_entry = netsnmp_fsys_get_next( HRFS_entry );*/ michael@713: michael@713: HRFS_index = (HRFS_entry ? HRFS_entry->idx.oids[0] : -1 ); michael@713: return HRFS_index; michael@325: Index: agent/snmpd.c michael@353: diff -Nau agent/snmpd.c.orig agent/snmpd.c michael@353: --- agent/snmpd.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ agent/snmpd.c 2011-09-15 09:22:41.994430685 +0200 michael@353: @@ -440,7 +440,7 @@ michael@353: int log_set = 0; michael@325: int uid = 0, gid = 0; michael@325: int agent_mode = -1; michael@325: - char *pid_file = NULL; michael@325: + char *pid_file = "@l_prefix@/var/snmp/snmpd.pid"; michael@325: char option_compatability[] = "-Le"; michael@325: #if HAVE_GETPID michael@325: int fd; michael@325: Index: apps/snmptrapd.c michael@353: diff -Nau apps/snmptrapd.c.orig apps/snmptrapd.c michael@353: --- apps/snmptrapd.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ apps/snmptrapd.c 2011-09-15 09:22:50.270293197 +0200 michael@588: @@ -653,6 +653,7 @@ michael@325: */ michael@325: #if HAVE_GETPID michael@325: strcat(options, "p:"); michael@325: + parse_config_pidFile(NULL, "@l_prefix@/var/snmp/snmptrapd.pid"); michael@325: #endif michael@325: michael@353: #ifndef NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG michael@325: Index: include/net-snmp/library/system.h michael@353: diff -Nau include/net-snmp/library/system.h.orig include/net-snmp/library/system.h michael@353: --- include/net-snmp/library/system.h.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ include/net-snmp/library/system.h 2011-09-15 09:22:50.271350973 +0200 michael@353: @@ -155,7 +155,8 @@ michael@325: #endif michael@325: #ifndef HAVE_SETENV michael@325: NETSNMP_IMPORT michael@325: - int setenv(const char *, const char *, int); michael@325: + int __netsnmp_setenv(const char *, const char *, int); michael@325: +# define setenv(a,b,c) __netsnmp_setenv(a,b,c) michael@325: #endif michael@325: michael@325: NETSNMP_IMPORT michael@325: Index: snmplib/system.c michael@353: diff -Nau snmplib/system.c.orig snmplib/system.c michael@353: --- snmplib/system.c.orig 2011-07-02 00:35:46.000000000 +0200 michael@353: +++ snmplib/system.c 2011-09-15 09:22:50.274625796 +0200 michael@588: @@ -1048,7 +1048,7 @@ michael@325: michael@325: #ifndef HAVE_SETENV michael@325: int michael@325: -setenv(const char *name, const char *value, int overwrite) michael@325: +__netsnmp_setenv(const char *name, const char *value, int overwrite) michael@325: { michael@325: char *cp; michael@325: int ret; michael@589: Index: include/net-snmp/system/freebsd8.h michael@589: --- include/net-snmp/system/freebsd8.h.orig 2011-09-28 06:53:47.000000000 +0200 michael@589: +++ include/net-snmp/system/freebsd8.h 2011-12-11 11:33:36.000000000 +0100 michael@589: @@ -1,3 +1,6 @@ michael@589: +/* freebsd8 is a superset of freebsd7 */ michael@589: +#include "freebsd7.h" michael@589: +#define freebsd7 freebsd7 michael@589: /* freebsd8 is a superset of freebsd4 */ michael@589: #include "freebsd7.h" michael@589: #define freebsd7 freebsd7 michael@589: Index: include/net-snmp/system/freebsd9.h michael@589: --- include/net-snmp/system/freebsd9.h.orig 2011-09-28 06:53:47.000000000 +0200 michael@589: +++ include/net-snmp/system/freebsd9.h 2011-12-11 11:33:36.000000000 +0100 michael@589: @@ -1,3 +1,6 @@ michael@589: +/* freebsd9 is a superset of freebsd8 */ michael@589: +#include "freebsd8.h" michael@589: +#define freebsd8 freebsd8 michael@589: /* freebsd9 is a superset of freebsd4 */ michael@589: #include "freebsd8.h" michael@589: #define freebsd9 freebsd9